package cloud.take.off.controller.sys;

import cloud.take.off.module.common.R;
import cloud.take.off.module.system.entity.UserInfo;
import cloud.take.off.module.system.query.UserInfoDTO;
import cloud.take.off.module.system.vo.UserInfoVO;
import cloud.take.off.service.sys.UserInfoService;
import cloud.take.off.wrapper.UserInfoWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: TODO
 * @Author: Take-off
 * @Date: 2024/8/30 3:53 PM
 * @Param
 * @return
 * @Version: 1.0
 **/
@RestController
@RequestMapping("/user")
@AllArgsConstructor
@Api(value = "用户管理", tags = "系统-用户管理")
public class UserInfoController {

    private final UserInfoService userInfoService;

    private final UserInfoWrapper userInfoWrapper;

    /**
     * 保存用户信息
     * @return
     */
    @PostMapping("/submit")
    @ApiOperation(value = "新增或修改", notes = "新增或修改")
    public R submit(@RequestBody UserInfoVO userInfoVo){
        boolean result =  userInfoService.submit(userInfoVo);
        return R.status(result);
    }

    @PostMapping("/detail")
    @ApiOperation(value = "详情", notes = "传 dto")
    public R<UserInfoVO> detail(@RequestBody UserInfoDTO dto) {
        UserInfoVO infoVO = userInfoService.detail(dto);
        return R.data(infoVO);
    }

}
